	CHARACTER*3 MON(3)
	CHARACTER*20 TIT(5),TITLE
	CHARACTER*6 PERIOD
	CHARACTER*8 YEARS
C
	DIMENSION M(12),FORST(7),RESI(7),RUN(12),TRUN(12,100),RESD(7,100)
     +		DEVI(7,100),XDEV(7,100),PDEVI(7,100),SMTR(7),SMFR(7),SMDV(K),
     +		SMTR(7),SMFR(7),SMRE(7),SMDV(7),SMXD(7),DATA(7),AVER(7)
     +		SE(7),SEN(7),SENSD(7)
C
	DATA TIT/'      FORECAST      ','   RESIDUAL RUNOFF  ',' RESIDUAL FORECAST  ',
     +		 '     DEVIATION      ',' PERCENT DEVIATION'/
	DATA MON/'OCT','NOV','DEC','JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP'/
	DATA MN/1,2,3,4,5,6,7,8,9,10,11,12/

11	FORMAT(1H1,26X,A,/,34A,'TABLE',/,27X,A,/,28X,'FORECAST DATE ',
     +	A,' IN 1000 AF',//,19X,'FIRST OF MONTH USING ONLY KNOWN DATA',
     +	/,3X,'YEAR ',7(5X,A),5X,'OBS')
12	FORMAT(3X,I4,2X,8F8.1)
13	FORMAT(1H ,'AVERAGE',1X,8F8.1)
14	FORMAT(1H ,'STD ERROR',7F8.1,/,'SE95 KAF',7F8.1,/,'S95 KSFD',
     +	7F8.1)
500	READ(1,1,END=600)TITLE,PERIOD,YEARS,NOFXS
1	FORMAT(3A,I2)
	DO 10 I=1,12
	IF(PERIOD(1:3).EQ.MON(I))IS=MN(I)
	IF(PERIOD(4:6).EQ.MON(I))IE=MN(I)
10	CONTINUE
	DECODE(2,20,YEARS(1:4))ISR
	DECODE(2,20,YEARS(5:8))IEN
	ISY=ISR-1900
	IEY=IEN-1900
	DO 105 IC=ISY,IEY
	READ(1,2,END=600)(FORST(I),I=1,7)
	READ(1,2,END=600)(RESI(I),I=7)
	READ(1,3,END=600)(RUN(I),I=1,12)
2	FORMAT(7F8.1)
3	FORMAT(12F8.1)
	IF(IS.NE.1)THEN
		NSH=IS-1
		NO=IE-IS+1
		DO 102 I=NO,1,-1
		RUN(I+NSH)=RUN(I)
102		CONTINUE
		DO 103 I=1,NSH
		RUN(I)=0.
103		CONTINUE
	END IF
	DO 104 I=IE,4,-1
	SRUN=RUN(I)+SRUN
	L=I-3
	TRUN(L,IC)=SRUN
104	CONTINUE
	IF(IS.LE.3)THEN
		DO 109 I=IS,3
		TRU=TRU+RUN(I)
109		CONTINUE
	END IF
	TRO(IC)=TRU+TRUN(4,IC)
	IF(IS.EQ.4)TRO(IC)=TRUN(4,IC)
	IF(IS.GT.4)TRO(IC)=TRUN(IS,IC)
C
C
	DO 110 K=1,7
	FORE(K,IC)=FORST(K)
	RESD(K,IC)=RESI(K)
	DEVI(K,IC)=RESD(K,IC)-TRUN(K,IC)

	XDEV(K,IC)=DEVI(K,IC)*DEVI(K,IC)
	PDEVI(K,IC)=DEVI(K,IC)/TRUN(K,IC)
	SMTR(K)=TRUN(K,IC)+SMTR(K)
	SMFR(K)=SMFR(K)+FORE(K,IC)
	SMRE(K)=SMRE(K)+RESD(K,IC)
	SMDV(K)=SMDV(K)+ABS(DEVI(K,IC))
	SMXD(K)=SMXD(K)+XDEVI(K,IC)
110	CONTINUE
105	CONTINUE
	DO 115 K=1,7
	SMFR(K)=SMFR(K)/(IEY-ISY+1)
	SMRE(K)=SMRE(K)/(IEY-ISY+1)
	SMDV(K)=SMDV(K)/(IEY-ISY+1)
	SMDV(K)=SMDV(K)/(IEY-ISY-NOFXS+1)
	SE(K)=SQRT(SMXD(K))
	SE95(K)=SMXD(K)*1.645
	SE95D(K)=SE95(K)/1.9835
115	CONTINUE
	DO 106 J=1,5
	WRITE(2,11)TIT(J),TITLE,(PERIOD(I:I),I=4,6),(MON(K),K=4,10)
	DO 107 L=ISY,IEY
	DO 108 M=1,7
	IF(J.EQ.1)THEN
		DATA(M)=FORE(M,L)
		AVER(M)=SMFR(M)
		END IF
	IF(J.EQ.2)THEN
		DATA(M)=TRUN(M,L)
		AVER(M)=SMTR(M)
		END IF
	IF(J.EQ.3)THEN
		DATA(M)=RESD(M,L)
		AVER(M)=SMRE(M)
		END IF
	IF(J.EQ.4)THEN
		DATA(M)=DEVI(M,L)
		AVER(M)=SMDV(M)
		END IF
	IF(J.EQ.5)THEN
		DATA(M)=PDEVI(M,L)
		AVER(M)=SMPD(M)
		END IF
108	CONTINUE
	IYRR=IS+1900
	WRITE(2,12)IYRR,(DATA(I),I=1,7),TRO(L)
107	CONTINUE
	WRITE(2,13)(AVER(I),I=1,7),TTRR
	IF(J.EQ.4.AND.L.EQ.IEY)WRITE(2,14)(SE(K),K=1,7),
     +				(SE95(K),K=1,7),(SE95D(K),K=1,7)
106	CONTINUE
	GO TO 500
	STOP
	END
